/**
 * zoneland.net Inc.
 * Copyright (c) 2002-2012 All Rights Reserved.
 */
package net.zoneland.knowledge.model;

import java.util.Map;
import java.util.Optional;

import org.apache.commons.lang3.ArrayUtils;

/**
 * 系统内部返回定义.
 * @author Pbody
 * 15:50 2020/3/23
 **/
public class ResultInfo {

    private boolean result;    //成功或失败
    private String info;         //信息说明
    private Object data;            //数据正文
    private Object[] objects;    //具体实体信息
    private Map map;    //具体实体信息

    /**
     * Gets the value of result.
     *
     * @return the value of result
     */
    public boolean isResult() {
        return result;
    }
    /**
     * Sets the result.
     *
     * <p>You can use setResult() to get the value of message</p>
     *
     * @param result result
     */
    public void setResult(final boolean result) {
        this.result = result;
    }

    /**
     * Gets the value of info.
     *
     * @return the value of info
     */
    public String getInfo() {
        return info;
    }

    /**
     * Sets the info.
     *
     * <p>You can use getInfo() to get the value of info</p>
     *
     * @param info info
     */
    public void setInfo(final String info) {
        this.info = info;
    }

    /**
     * Gets the value of data.
     *
     * @return the value of data
     */
    public Object getData() {
        return data;
    }

    /**
     * Sets the data.
     *
     * <p>You can use getData() to get the value of data</p>
     *
     * @param data data
     */
    public void setData(final Object data) {
        this.data = data;
    }
    /**
     * Gets the value of data.
     *
     * @return the value of data
     */
    public Object[] getObjects() {
        return Optional.ofNullable(objects).map(ArrayUtils::clone).orElse(null);
    }
    /**
     * Sets the data.
     *
     * <p>You can use getData() to get the value of data</p>
     *
     * @param objects data
     */
    public void setObjects(final Object[] objects) {
        this.objects = Optional.ofNullable(objects).map(ArrayUtils::clone).orElse(null);
    }
    /**
     * Gets the value of data.
     *
     * @return the value of data
     */
    public Map getMap() {
        return map;
    }
    /**
     * Sets the data.
     *
     * <p>You can use getData() to get the value of data</p>
     *
     * @param map data
     */
    public void setMap(final Map map) {
        this.map = map;
    }
}
